Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - attempt to support remote includes #737

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

apupier
Copy link
Member

@apupier apupier commented Jun 29, 2023

from what i understood, placing the allow-uri-read in attributes should have done the thing but it is not working... to investigate

resolves #731

from what i understood, placing the allow-uri-read in attributes should
have done the thing but it is not working... to investigate

resolves asciidoctor#731

Signed-off-by: Aurélien Pupier <[email protected]>
@apupier
Copy link
Member Author

apupier commented Jun 30, 2023

@ggrossetie any hints how to investigate on this one?

@ggrossetie
Copy link
Member

The underlying error is:

Error: Command failed: "/usr/share/code/code" "/home/guillaume/Workspace/opensource/asciidoctor-vscode/node_modules/unxhr/lib/request.js" --ssl="true" --encoding="utf8" --request-options="{\"host\":\"raw.githubusercontent.com\",\"port\":443,\"path\":\"/asciidoctor/asciidoctor-vscode/master/CONTRIBUTING.adoc\",\"method\":\"GET\",\"headers\":{\"User-Agent\":\"node-XMLHttpRequest\",\"Accept\":\"*/*\",\"Host\":\"raw.githubusercontent.com\"},\"agent\":false,\"withCredentials\":false}"

We are using unxhr to fetch remote content synchronously (because we must resolve include synchronously). To do that, we use execSync.

I believe that the issue is that we are using ${process.execPath} which in this case resolves to /usr/share/code/code (which seems to be unable to execute a Node script).

https://github.com/ggrossetie/unxhr/blob/4fbc39978b99180c24cd31ac802c2b4ae5dca3c6/lib/XMLHttpRequest.js#L520

Not sure how we can execute a Node script using code (since we cannot be sure that node will be available in the PATH).

@apupier
Copy link
Member Author

apupier commented Aug 8, 2023

I believe that the issue is that we are using ${process.execPath} which in this case resolves to /usr/share/code/code (which seems to be unable to execute a Node script).

seems we are not the only ones to hit this kind of problem: https://stackoverflow.com/questions/75103016/node-execpath-references-vscode-installation-instead-of-path-to-node-installatio

asked on VS Code extension dev Slack channel https://vscode-dev-community.slack.com/archives/C74CB59NE/p1691498625819969 and VS Code Github discussions: microsoft/vscode-discussions#746

@apupier
Copy link
Member Author

apupier commented Aug 8, 2023

I'm wondering if we can use child_process.execFileSync instead of child_process.execSync in unxhr

@apupier
Copy link
Member Author

apupier commented Aug 14, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support remote includes
2 participants